package cn.item.buckle.business.pojo;

import java.io.Serializable;
import java.util.Map;
import java.util.Set;

public class MonitorCameraState implements Serializable {
	private static final long serialVersionUID = -5836350941927740722L;
	private long taskId;

	/** 正常的卡扣个数 */
	private int normalMonitorCount;

	/** 正常的摄像头个数 */
	private int normalCameraCount;

	/** 异常的卡扣个数 */
	private int abnormalMonitorCount;

	/** 异常的摄像头个数 */
	private int abnormalCameraCount;

	/** 异常的摄像头详细信息 */
	private Map<String, Set<String>> abnormalMonitorCameraInfo;

	public MonitorCameraState() {
	}

	public MonitorCameraState(int normalMonitorCount, int normalCameraCount, int abnormalMonitorCount, int abnormalCameraCount, Map<String, Set<String>> abnormalMonitorCameraInfo) {
		this.normalMonitorCount = normalMonitorCount;
		this.normalCameraCount = normalCameraCount;
		this.abnormalMonitorCount = abnormalMonitorCount;
		this.abnormalCameraCount = abnormalCameraCount;
		this.abnormalMonitorCameraInfo = abnormalMonitorCameraInfo;
	}

	public long getTaskId() {
		return taskId;
	}

	public void setTaskId(long taskId) {
		this.taskId = taskId;
	}

	public int getNormalMonitorCount() {
		return normalMonitorCount;
	}

	public void setNormalMonitorCount(int normalMonitorCount) {
		this.normalMonitorCount = normalMonitorCount;
	}

	public void addNormalMonitorCount(int normalMonitorCount) {
		this.normalMonitorCount += normalMonitorCount;
	}

	public int getNormalCameraCount() {
		return normalCameraCount;
	}

	public void setNormalCameraCount(int normalCameraCount) {
		this.normalCameraCount = normalCameraCount;
	}

	public void addNormalCameraCount(int normalCameraCount) {
		this.normalCameraCount += normalCameraCount;
	}

	public int getAbnormalMonitorCount() {
		return abnormalMonitorCount;
	}

	public void setAbnormalMonitorCount(int abnormalMonitorCount) {
		this.abnormalMonitorCount = abnormalMonitorCount;
	}

	public void addAbnormalMonitorCount(int abnormalMonitorCount) {
		this.abnormalMonitorCount += abnormalMonitorCount;
	}

	public int getAbnormalCameraCount() {
		return abnormalCameraCount;
	}

	public void setAbnormalCameraCount(int abnormalCameraCount) {
		this.abnormalCameraCount = abnormalCameraCount;
	}

	public void addAbnormalCameraCount(int abnormalCameraCount) {
		this.abnormalCameraCount += abnormalCameraCount;
	}

	public String getAbnormalMonitorCameraInfo() {
		String abnormalMonitorCameraInfoStr = "";
		if (this.abnormalMonitorCameraInfo != null && !this.abnormalMonitorCameraInfo.isEmpty()) {
			StringBuilder sb = new StringBuilder();
			this.abnormalMonitorCameraInfo.forEach((k, v) -> {
				sb.append("~").append(k).append(":").append(String.join(",", v));
			});
			abnormalMonitorCameraInfoStr = sb.substring(1);
		}
		return abnormalMonitorCameraInfoStr;
	}

	public Map<String, Set<String>> getAbnormalMonitorCameraInfoForMap() {
		return abnormalMonitorCameraInfo;
	}

	public void setAbnormalMonitorCameraInfo(Map<String, Set<String>> abnormalMonitorCameraInfo) {
		this.abnormalMonitorCameraInfo = abnormalMonitorCameraInfo;
	}

	public void addAbnormalMonitorCameraInfo(Map<String, Set<String>> abnormalMonitorCameraInfo) {
		if (this.abnormalMonitorCameraInfo == null || this.abnormalMonitorCameraInfo.isEmpty()) {
			this.abnormalMonitorCameraInfo = abnormalMonitorCameraInfo;
		} else if (abnormalMonitorCameraInfo != null && !abnormalMonitorCameraInfo.isEmpty()) {
			abnormalMonitorCameraInfo.forEach((k, v) -> {
				if (this.abnormalMonitorCameraInfo.containsKey(k)) {
					this.abnormalMonitorCameraInfo.get(k).addAll(v);
				} else {
					this.abnormalMonitorCameraInfo.put(k, v);
				}
			});
		}

	}

	@Override
	public String toString() {
		return "normalMonitorCount=" + this.normalMonitorCount
				+ "|normalCameraCount=" + this.normalCameraCount
				+ "abnormalMonitorCount=" + this.abnormalMonitorCount
				+ "|abnormalCameraCount=" + this.abnormalCameraCount
				+ "|abnormalMonitorCameraInfo=" + getAbnormalMonitorCameraInfo();
	}
}
